Predicting ADHD from Resting-State fMRI¶
In this project, we work on resting-state fMRI data to investigate brain connectivity patterns.
# Import necessary libraries
import os
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from nilearn import datasets, maskers, plotting
from nilearn.input_data import NiftiLabelsMasker
from nilearn.connectome import ConnectivityMeasure
# Ignore warnings for cleaner output
import warnings
warnings.filterwarnings('ignore')
c:\Users\lacom\anaconda3\lib\site-packages\nilearn\input_data\__init__.py:23: FutureWarning: The import path 'nilearn.input_data' is deprecated in version 0.9. Importing from 'nilearn.input_data' will be possible at least until release 0.13.0. Please import from 'nilearn.maskers' instead. warnings.warn(message, FutureWarning)
- This section imports the necessary Python libraries for various tasks:
os: This module provides a portable way of using operating system-dependent functionality.pandas as pd: Pandas is a powerful data manipulation library. It's commonly imported aspdfor brevity.numpy as np: NumPy is a library for numerical computing in Python. It's often imported asnpfor brevity.matplotlib.pyplot as plt: Matplotlib is a plotting library for Python. Thepyplotmodule provides a MATLAB-like interface for plotting.seaborn as sns: Seaborn is a statistical data visualization library based on Matplotlib. It provides a high-level interface for drawing attractive and informative statistical graphics.nilearn.datasets: Nilearn is a Python module for fast and easy statistical learning on neuroimaging data. It provides datasets and tools specifically tailored for neuroimaging analysis.nilearn.maskers: This submodule contains tools for extracting data from neuroimaging data formats.nilearn.plotting: This submodule provides functions to plot various neuroimaging data.NiftiLabelsMasker: This class in Nilearn is used to extract time series from regions defined by labels in a Nifti image.ConnectivityMeasure: This class in Nilearn is used to compute connectivity matrices from neuroimaging data.
data = datasets.fetch_adhd(n_subjects=None, data_dir=None, url=None, resume=True, verbose=1)
This line of code is using the fetch_adhd function from the datasets module in the nilearn library to download the ADHD dataset. Let's break down the parameters used in this function:
n_subjects: This parameter specifies the number of subjects to fetch from the dataset. When set toNone, it fetches all available subjects.data_dir: This parameter specifies the directory where the data will be stored. When set toNone, it uses the default data directory.url: This parameter specifies the URL from which to download the dataset. When set toNone, it uses the default URL.resume: This parameter determines whether to resume downloading if a partial download exists. When set toTrue, it resumes the download if it was interrupted.verbose: This parameter controls the verbosity of the output during the download process. When set to1, it displays progress information during the download.
Once executed, this line will download the ADHD dataset and store it in the specified directory (or the default directory if none is provided). It will fetch all available subjects in the dataset. Additionally, it will display progress information during the download process.
# Get the keys
print('Keys:',list(data.keys()))
# Get the number of subjects
print('Number of subjects:', len(data.func))
Keys: ['func', 'confounds', 'phenotypic', 'description'] Number of subjects: 40
data.description
"ADHD 200\n\n\nNotes\n-----\nPart of the 1000 Functional Connectome Project. Phenotypic\ninformation includes: diagnostic status, dimensional ADHD symptom measures,\nage, sex, intelligence quotient (IQ) and lifetime medication status.\nPreliminary quality control assessments (usable vs. questionable) based upon\nvisual timeseries inspection are included for all resting state fMRI scans.\n\nIncludes preprocessed data from 40 participants.\n\nProject was coordinated by Michael P. Milham.\n\nContent\n-------\n :'func': Nifti images of the resting-state data\n :'phenotypic': Explanations of preprocessing steps\n :'confounds': CSV files containing the nuisance variables\n\nReferences\n----------\nFor more information about this dataset's structure:\nhttp://fcon_1000.projects.nitrc.org/indi/adhd200/index.html\n\nLicence: usage is unrestricted for non-commercial research purposes.\n"
The data.description provides detailed information about the ADHD dataset.
Dataset Name: ADHD 200
Notes:
- This dataset is part of the 1000 Functional Connectome Project.
- Phenotypic information includes diagnostic status, dimensional ADHD symptom measures, age, sex, intelligence quotient (IQ), and lifetime medication status.
- Preliminary quality control assessments (usable vs. questionable) based on visual timeseries inspection are included for all resting-state fMRI scans.
- It includes preprocessed data from 40 participants.
- The project was coordinated by Michael P. Milham.
Content:
'func': Nifti images of the resting-state data.'phenotypic': Explanations of preprocessing steps.'confounds': CSV files containing the nuisance variables.
References:
- For more information about the dataset's structure, a reference link is provided: ADHD 200 Dataset Structure.
License:
- Usage is unrestricted for non-commercial research purposes.
Explore the Target Variable (Y)¶
# Let's load the phenotype data
pheno = pd.DataFrame(data.phenotypic)
This line of code loads the phenotype data from the ADHD dataset into a Pandas DataFrame named pheno.
Loading Phenotype Data:
data.phenotypic: This accesses the phenotypic data from thedataobject, which is assumed to be a dictionary-like object containing various components of the ADHD dataset, including the phenotype information.pd.DataFrame(): This function from the Pandas library converts the phenotypic data into a DataFrame, a two-dimensional labeled data structure with columns of potentially different types.pheno: This variable is assigned to hold the DataFrame containing the phenotype data.
After executing this line, the pheno DataFrame will contain the phenotype information from the ADHD dataset, with each row representing a subject and each column representing a specific phenotypic variable (e.g., diagnostic status, ADHD symptom measures, age, sex, IQ, medication status).
# INFO
df = pheno
# Display the shape of the data
print("Data Shape:")
print(df.shape)
# Check for any duplicate entries in the data.
print('')
print("Duplicate Values:")
print('(',df.duplicated().sum(),')')
# Display the data types of the columns
print("\nData Types:")
print(df.dtypes.value_counts())
# Check for missing values
missing_columns = df.columns[df.isnull().any()]
if missing_columns.size > 0:
missing_values = df[missing_columns].isnull().sum()
missing_percentage = (missing_values / len(df)) * 100
# Combine missing_values and missing_percentage into a single DataFrame
missing_data = pd.concat([missing_values, missing_percentage], axis=1, keys=['Total', 'Percent'])
# Sort the missing_data DataFrame by Total column in descending order
missing_data = missing_data.sort_values(by='Total', ascending=False)
# Print missing data
print("\nMissing Data:")
print(missing_data.to_string())
else:
print("\nNo Missing Values Found")
Data Shape: (40, 65) Duplicate Values: ( 0 ) Data Types: object 54 float64 7 int32 4 Name: count, dtype: int64 No Missing Values Found
pheno.head(5)
| f0 | Subject | RestScan | MeanFD | NumFD_greater_than_020 | rootMeanSquareFD | FDquartiletop14thFD | PercentFD_greater_than_020 | MeanDVARS | MeanFD_Jenkinson | ... | sess_1_rest_6_eyes | sess_1_anat_1 | sess_1_which_anat | sess_2_rest_1 | sess_2_rest_1_eyes | sess_2_rest_2 | sess_2_rest_2_eyes | sess_2_anat_1 | defacing_ok | defacing_notes | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | "21" | 10042 | "rest_1" | 0.0559 | 0 | 0.2365 | 0.0922 | 0.0000 | 2.2915 | 1.0089 | ... | NA | "pass" | NA | NA | NA | NA | NA | NA | "" | "" |
| 1 | "19" | 10064 | "rest_1" | 0.0623 | 0 | 0.2496 | 0.0926 | 0.0000 | 2.0866 | 0.9943 | ... | NA | "pass" | NA | NA | NA | NA | NA | NA | "" | "" |
| 2 | "22" | 10128 | "rest_1" | 0.0689 | 0 | 0.2624 | 0.1132 | 0.0000 | 2.1422 | 1.2641 | ... | NA | "pass" | NA | NA | NA | NA | NA | NA | "" | "" |
| 3 | "20" | 21019 | "rest_1" | 0.0575 | 0 | 0.2398 | 0.0955 | 0.0000 | 2.0339 | 1.1973 | ... | NA | "pass" | NA | NA | NA | NA | NA | NA | "yes" | "" |
| 4 | "30" | 23008 | "rest_1" | 0.0801 | 7 | 0.2831 | 0.1710 | 8.9744 | 13.4263 | 1.7741 | ... | NA | "pass" | NA | NA | NA | NA | NA | NA | "yes" | "" |
5 rows × 65 columns
pheno[['tdc','adhd','age','sex']].head(10)
| tdc | adhd | age | sex | |
|---|---|---|---|---|
| 0 | 0 | 1 | 10.65 | "M" |
| 1 | 0 | 1 | 15.90 | "M" |
| 2 | 1 | 0 | 9.53 | "M" |
| 3 | 1 | 0 | 15.53 | "M" |
| 4 | 1 | 0 | 9.17 | "M" |
| 5 | 0 | 1 | 11.33 | "F" |
| 6 | 0 | 1 | 20.82 | "M" |
| 7 | 0 | 1 | 19.08 | "M" |
| 8 | 0 | 1 | 13.35 | "M" |
| 9 | 0 | 1 | 17.74 | "M" |
print('Number of classes:',pheno['sex'].value_counts())
Number of classes: sex "M" 35 "F" 5 Name: count, dtype: int64
y = pheno['adhd']
print('Number of classes:',y.unique())
sns.set_style("white")
sns.set_palette("muted")
sns.countplot(x= y)
print(y.value_counts())
Number of classes: [1 0] adhd 1 20 0 20 Name: count, dtype: int64
AGE DISTRIBUTION
age = pheno['age']
age.describe()
count 40.000000 mean 12.503586 std 3.373002 min 8.580000 25% 9.830000 50% 11.330000 75% 14.580000 max 20.820000 Name: age, dtype: float64
sns.set_style("dark")
sns.set_palette("dark")
sns.histplot(age)
#skewness and kurtosis
print("Asymmetry: %f" % y.skew())
print("Kurtosis: %f" % y.kurt())
Skewness: 0.000000 Kurtosis: -2.108108
The provided values represent the skewness and kurtosis of the 'age' column in the ADHD dataset.
Skewness:
- Skewness measures the asymmetry of the distribution of values in a dataset.
- A skewness of 0 indicates a symmetric distribution.
- In this case, the skewness value of 0.000000 suggests that the distribution of ages is approximately symmetric.
Kurtosis:
- Kurtosis measures the "tailedness" or the degree of outliers in the distribution of values.
- A negative kurtosis indicates a platykurtic distribution, meaning the distribution has thinner tails and fewer outliers compared to a normal distribution.
- The kurtosis value of -2.108108 suggests a platykurtic distribution for the ages in this dataset, indicating fewer outliers compared to a normal distribution.
Load the atlas
The DiFuMo atlas provides dictionaries of functional modes optimized for extracting functional signals from fMRI data, available in various dimensionalities (64, 128, 256, 512, and 1024).
Has multiple resolutions, for larger networks or finer-grained ROIs.
Let's use a 64-ROI atlas to allow some detail, but to ultimately keep our connectivity matrices manageable
dim = 64
difumo = datasets.fetch_atlas_difumo(
dimension=dim, resolution_mm=2, legacy_format=False
)
atlas_filename = difumo.maps
This code segment loads the DiFuMo atlas, which provides dictionaries of functional modes optimized for extracting functional signals from fMRI data.
Specifying Atlas Dimensionality:
- This line sets the desired dimensionality of the atlas to 64. This means the atlas will contain 64 regions of interest (ROIs).
Fetching the Atlas:
- This line fetches the DiFuMo atlas using the
fetch_atlas_difumofunction from thedatasetsmodule in thenilearnlibrary. - Parameters:
dimension=dim: Specifies the desired dimensionality of the atlas.resolution_mm=2: Sets the resolution of the atlas in millimeters. Here, it's set to 2 mm.legacy_format=False: This parameter is set toFalse, indicating that the fetched atlas will use the non-legacy format.
- This line fetches the DiFuMo atlas using the
Accessing Atlas Filename:
- This line extracts the filename of the atlas maps from the fetched
difumoobject.
- This line extracts the filename of the atlas maps from the fetched
After executing this code, the variable atlas_filename will contain the filename of the DiFuMo atlas maps corresponding to the specified dimensionality (64 ROIs) and resolution.
difumo.labels
| component | difumo_names | yeo_networks7 | yeo_networks17 | gm | wm | csf | |
|---|---|---|---|---|---|---|---|
| 0 | 1 | Superior frontal sulcus | DefaultB | DefaultA | 0.689996 | 0.185709 | 0.116884 |
| 1 | 2 | Fusiform gyrus | No network found | No network found | 0.844733 | 0.021026 | 0.133789 |
| 2 | 3 | Calcarine cortex posterior | VisCent | VisPeri | 0.601768 | 0.302067 | 0.091297 |
| 3 | 4 | Cingulate cortex posterior | DefaultB | DefaultA | 0.740086 | 0.140368 | 0.119567 |
| 4 | 5 | Parieto-occipital sulcus superior | ContA | ContC | 0.640157 | 0.241492 | 0.117826 |
| ... | ... | ... | ... | ... | ... | ... | ... |
| 59 | 60 | Cuneus | VisCent | VisPeri | 0.627179 | 0.269783 | 0.103005 |
| 60 | 61 | Middle temporal gyrus | DefaultB | DefaultB | 0.726527 | 0.149595 | 0.107329 |
| 61 | 62 | Superior frontal gyrus | DefaultB | DefaultB | 0.651182 | 0.062243 | 0.224067 |
| 62 | 63 | Central sulcus | SomMotA | SomMotB | 0.578502 | 0.291674 | 0.109244 |
| 63 | 64 | Caudate | No network found | No network found | 0.703295 | 0.260386 | 0.036332 |
64 rows × 7 columns
The provided data contains information about the labels of the regions in the DiFuMo atlas.
Columns:
component: Represents the index or identifier of each region in the atlas.difumo_names: Provides the name of the region according to the DiFuMo atlas.yeo_networks7: Indicates the Yeo 7-network assignment for the region.yeo_networks17: Indicates the Yeo 17-network assignment for the region.gm: Represents the gray matter probability for the region.wm: Represents the white matter probability for the region.csf: Represents the cerebrospinal fluid probability for the region.
Rows:
- Each row corresponds to a specific region in the atlas, indexed by the
componentcolumn.
- Each row corresponds to a specific region in the atlas, indexed by the
Data:
- The data provides information about the anatomical and network assignments of each region, as well as probabilities of gray matter, white matter, and cerebrospinal fluid for each region.
This information is useful for understanding the anatomical and functional properties associated with each region in the DiFuMo atlas, which can be utilized in various neuroimaging analyses and interpretations.
Extract features with nilearn masker¶
Compute a correlation matrix, representing regional coactivation between regions and extract signals from a brain parcellation
from nilearn.maskers import MultiNiftiMapsMasker
from nilearn.connectome import ConnectivityMeasure
# create masker using MultiNiftiMapsMasker to extract functional data within
# atlas parcels from multiple subjects using parallelization to speed up the
# # computation
masker = MultiNiftiMapsMasker(
maps_img=atlas_filename,
standardize="zscore_sample",
standardize_confounds="zscore_sample",
memory="nilearn_cache",
n_jobs=2, verbose=0
)
# ConenctivityMeasure from Nilearn uses simple 'correlation' to compute
# connectivity matrices for all subjects in a list
connectome_measure = ConnectivityMeasure(
kind="correlation", vectorize=True, discard_diagonal=True)
Extract fMRI connectivity features from every subject.
all_features = [
correlation_measure.fit_transform([masker.fit_transform(sub, confounds=data.confounds[i])])[0]
for i, sub in enumerate(data.func)
]
Extracting fMRI Connectivity Features:
- We want to analyze the functional MRI (fMRI) data from each subject to understand how different brain regions are connected or related.
- To do this, we use the
correlation_measureobject we created earlier. This object knows how to compute correlation matrices, which show the strength of connections between brain regions. - We also use the
maskerobject we set up to extract data from specific brain regions defined in the atlas. - The
fit_transformmethod of themaskerobject takes the fMRI data from each subject (sub) and extracts information from the brain regions defined in the atlas. We also provide confound data to control for any factors that might influence the results. - Then, we pass this extracted data to the
correlation_measureobject'sfit_transformmethod to compute the correlation matrices. - This process is repeated for each subject in the dataset (
data.func), and the resulting correlation matrices are stored in theall_featureslist.
Understanding the Code:
enumerate(data.func): This iterates over the functional MRI data for each subject (sub) in the dataset, providing both the index (i) and the data itself.correlation_measure.fit_transform(...): This computes the correlation matrices for the extracted data.[0]at the end of the list comprehension: This is just accessing the first (and only) element in the list returned byfit_transform, as we're only interested in the correlation matrices.
In summary, we're using the masker and correlation_measure objects to process the fMRI data from each subject, extract connectivity features, and compute correlation matrices to understand how different brain regions are connected. These correlation matrices are then stored in the all_features list for further analysis.
# METHOD 2
# extract time series from all subjects
#time_series = masker.fit_transform(data_adhd, confounds=data_confounds)
# calculate correlation matrices across subjects and display
#correlation_matrices = connectome_measure.fit_transform(time_series)
# Let's save the data to disk
np.savez_compressed('ADHD_Difumo_features.npz',a = all_features)
# Load the features
feat_file = 'ADHD_Difumo_features.npz'
X_features = np.load(feat_file)['a']
print('Features shape:', X_features.shape)
Features shape: (40, 2016)
The 2016 features represent matrices of correlations.
Number of Subjects:
- We have data for 40 subjects, as indicated by the first dimension of the shape
(40, 2016).
- We have data for 40 subjects, as indicated by the first dimension of the shape
Number of Features:
- Each subject has a set of features associated with it.
- In this case, each subject's features consist of a correlation matrix.
- The correlation matrix represents the strength of connections between different brain regions.
- Since each correlation matrix has been vectorized (flattened into a one-dimensional array) using the
vectorize=Trueparameter when computing connectivity measures, each matrix is represented by 2016 features. - This number is derived from the fact that a symmetric matrix with 64 rows/columns (as in the case of the 64-ROI atlas used) would have ( \frac{{64 \times (64 + 1)}}{2} = 2016 ) unique elements after being vectorized, as it includes the diagonal elements.
So, each of the 2016 features corresponds to a specific connection between two brain regions in the correlation matrix. Each subject's set of features contains information about how strongly these connections are correlated.
# Create the plot
plt.figure(figsize=(6, 4))
plt.imshow(X_features, aspect='auto', cmap='Pastel2', interpolation='nearest')
# Add colorbar
plt.colorbar(label='Correlation')
# Add title and labels
plt.title('Feature Matrix', fontsize=14)
plt.xlabel('Features', fontsize=12)
plt.ylabel('Subjects', fontsize=12)
# Show the plot
plt.tight_layout()
plt.show()
Prepare data for machine learning¶
y_adhd = pheno['adhd']
print('y type:',type(y_adhd))
print('X type:',type(X_features))
y type: <class 'pandas.core.series.Series'> X type: <class 'numpy.ndarray'>
from sklearn.model_selection import train_test_split
# Split the sample into training/test, stratify by age class, and shuffle the data
X_train, X_test, y_train, y_test = train_test_split(
X_features, # X
y_adhd, # y
test_size=0.2, # 80%/20% split
shuffle=True, # shuffle dataset before splitting
stratify=y, # keep distribution of ageclass consistent between train & test sets.
random_state=123 # same shuffle each time
)
# Print the size of the training and test sets
print('training:', len(X_train), 'testing:', len(X_test))
training: 24 testing: 16
This code snippet utilizes the train_test_split function from scikit-learn to split the dataset into training and testing sets for machine learning:
Splitting the Data:
train_test_splitdivides the dataset into training and testing subsets.X_featuresrepresents the feature matrix containing the correlation features, andy_adhdis the target variable indicating ADHD diagnosis.test_size=0.2specifies that 20% of the data will be used for testing, while 80% will be used for training.shuffle=Trueensures that the data is shuffled before splitting to prevent any potential biases in the dataset.stratify=y_adhdensures that the distribution of ADHD diagnosis classes is maintained in both the training and testing sets. This is important for ensuring representative samples in each subset.random_state=123sets the seed for random number generation, ensuring reproducibility of the split.
Printing Sizes of Sets:
- The sizes of the training and testing sets are printed using
len(X_train)andlen(X_test)respectively.
- The sizes of the training and testing sets are printed using
This process ensures that we have separate datasets for training and testing our machine learning models, with appropriate proportions and balanced class distributions.
# Check data distribution
sns.histplot(y_train, label='train', kde=True)
sns.histplot(y_test, label='test', kde=True)
plt.legend()
plt.xlabel('Value')
plt.ylabel('Frequency')
plt.title('Distribution of Target Variable')
plt.show()
# Print the size of the training and test sets
print('training:', len(X_train), 'testing:', len(X_test))
Run our model!¶
We'll start with a standard classification model called a Support Vector Classifier (SVC)
Despite its simplicity, this model shines in its ability to deliver robust results. Given our data constraints, a straightforward approach often proves to be the most effective.
from sklearn.svm import SVC
from sklearn.model_selection import train_test_split, GridSearchCV
from sklearn.metrics import accuracy_score, classification_report
# Create an instance of the Support Vector Classifier
svc_model = SVC()
# Define hyperparameters to tune
param_grid = {
'C': [0.1, 1, 10], # Penalty parameter C
'kernel': ['linear'], # Kernel type to be used in the algorithm
'gamma': ['scale', 'auto'] # Kernel coefficient for 'rbf', 'poly', and 'sigmoid'
}
# Perform grid search cross-validation
grid_search = GridSearchCV(estimator=svc_model, param_grid=param_grid, cv=5)
grid_search.fit(X_train, y_train)
# Get the best parameters
best_params = grid_search.best_params_
This code runs a Support Vector Classifier (SVC) model and performs hyperparameter tuning using grid search cross-validation:
Creating the SVC Model:
- An instance of the Support Vector Classifier (SVC) is created with the default hyperparameters.
Defining Hyperparameters to Tune:
- Hyperparameters are parameters that are not directly learned by the model during training but affect the learning process. In this case, we're tuning the following hyperparameters:
C: Penalty parameter C, which controls the trade-off between a smooth decision boundary and correctly classifying training points.kernel: The kernel type to be used in the algorithm. Here, we're using a linear kernel.gamma: The kernel coefficient for certain kernel types. For a linear kernel, this parameter is ignored.
- Hyperparameters are parameters that are not directly learned by the model during training but affect the learning process. In this case, we're tuning the following hyperparameters:
Performing Grid Search Cross-Validation:
- Grid search cross-validation is used to find the best combination of hyperparameters.
- It systematically evaluates different combinations of hyperparameters using cross-validation to determine which combination yields the best performance.
- The
cvparameter specifies the number of folds for cross-validation, which is set to 5 here.
Getting the Best Parameters:
- After grid search is complete, the best combination of hyperparameters is obtained using
grid_search.best_params_.
- After grid search is complete, the best combination of hyperparameters is obtained using
Overall, this code efficiently tunes the hyperparameters of the SVC model to optimize its performance on the training data.
# Train the model with the best parameters
best_svc_model = SVC(**best_params)
best_svc_model.fit(X_train, y_train)
# Make predictions on the test data
y_pred = best_svc_model.predict(X_test)
# Evaluate model performance
accuracy = accuracy_score(y_test, y_pred)
classification_rep = classification_report(y_test, y_pred)
# Print results
print("Best Parameters:", best_params)
print("Accuracy:", accuracy)
print("Classification Report:\n", classification_rep)
Best Parameters: {'C': 0.1, 'gamma': 'scale', 'kernel': 'linear'}
Accuracy: 0.5
Classification Report:
precision recall f1-score support
0 0.50 0.25 0.33 8
1 0.50 0.75 0.60 8
accuracy 0.50 16
macro avg 0.50 0.50 0.47 16
weighted avg 0.50 0.50 0.47 16
Classification report:
- Precision: How precise the model's positive predictions are.
- Recall: How many actual positives the model can identify.
- F1-score: A balance between precision and recall.
- Support: The number of instances for each class.
- Accuracy: Overall correctness of the model's predictions.
Support Vector Classifier (SVC) model with the best parameters obtained from grid search cross-validation, makes predictions on the test data, and evaluates the model's performance:
Training the Model with Best Parameters:
- We create an instance of the SVC model (
best_svc_model) using the best parameters obtained from grid search cross-validation. - The
SVCclass from scikit-learn is used, and we pass the best parameters (**best_params) to initialize the model. - We then fit the model to the training data (
X_trainandy_train) using thefitmethod.
- We create an instance of the SVC model (
Making Predictions:
- After training the model, we use it to make predictions on the test data (
X_test) using thepredictmethod. - The predicted labels are stored in the variable
y_pred.
- After training the model, we use it to make predictions on the test data (
Evaluating Model Performance:
- We compute the accuracy of the model by comparing the predicted labels (
y_pred) with the true labels (y_test) using theaccuracy_scorefunction. - Additionally, we generate a classification report using the
classification_reportfunction, which provides metrics such as precision, recall, and F1-score for each class. - The accuracy and classification report are printed to assess the model's performance on the test data.
- We compute the accuracy of the model by comparing the predicted labels (
The output shows the best parameters obtained from grid search cross-validation, the accuracy of the model on the test data, and the classification report containing performance metrics for each class (0 and 1) as well as aggregated metrics. In this example, the accuracy is 0.5, indicating moderate performance.
# Compute and plot the confusion matrix
from sklearn.metrics import confusion_matrix
conf_matrix = confusion_matrix(y_test, y_pred)
# Plot a prettier confusion matrix
plt.figure(figsize=(8, 6))
sns.set(font_scale=1.2) # Adjust font size for labels
sns.heatmap(
conf_matrix,
annot=True,
fmt="d",
cmap="Blues",
cbar=False,
square=True,
xticklabels=['CONTROL', 'ADHD'],
yticklabels=['CONTROL', 'ADHD'],
)
plt.xlabel("Predicted", fontsize=12)
plt.ylabel("True", fontsize=12)
plt.title("", fontsize=15)
plt.show()
Interpretation of the classification report:
Control:
- Precision: 0.50
- 50% of the instances predicted as control were actually control.
- Recall: 0.25
- 25% of the actual Control instances were correctly identified by the model.
- F1-score: 0.33
- This metric combines both precision and recall into a single value.
- Support: 8
- There are 8 instances of control in the test dataset.
- Precision: 0.50
ADHD:
- Precision: 0.50
- 50% of the instances predicted as ADHD were actually ADHD.
- Recall: 0.75
- 75% of the actual ADHD instances were correctly identified by the model.
- The model did a better job of capturing ADHD instances compared to control.
- F1-score: 0.60
- This indicates a better balance between precision and recall compared to control.
- Support: 8
- There are also 8 instances of ADHD in the test dataset.
- Precision: 0.50
Interpreting model feature importance¶
correlation_measure.inverse_transform(best_svc_model.coef_).shape
(1, 64, 64)
Interpreting Model Feature Importance:
- We're trying to understand which brain regions (features) are most important for predicting ADHD using the SVM model.
- To do this, we look at the coefficients (weights) assigned to each feature by the SVM model.
Coefficient Shape:
- After processing, we have a set of coefficients, each corresponding to a pair of brain regions.
- The shape of these coefficients is (1, 64, 64), which means we have one set of coefficients for each pair of brain regions.
Plotting Feature Importance:
- We visualize these coefficients using a bar plot.
- Each bar represents the weight assigned to a specific pair of brain regions by the SVM model.
- The x-axis shows the brain regions (features), and the y-axis shows the weights.
- We set the background color of the plot to dark blue for better visibility.
Essentially, this plot helps us understand which brain regions have the most influence on predicting ADHD based on their correlations. Each bar's height represents how important that specific brain region is in making accurate predictions.
# Get the coefficients (weights) of the linear SVM model from best_estimator
coefficients = best_svc_model.coef_
plt.bar(range(coefficients.shape[-1]),coefficients[0])
plt.gca().set_facecolor('darkblue') # Change background color
plt.title('feature importances')
plt.xlabel('feature')
plt.ylabel('weight')
Text(0, 0.5, 'weight')
Interpreting Model Feature Importance:
- This line of code aims to interpret the feature importance of the SVM model.
correlation_measure.inverse_transform(best_svc_model.coef_)is a function call that helps transform the coefficients of the SVM model back to the original space of the features.- The result of this transformation is stored in the variable
feat_exp_matrix.
Understanding the Result:
feat_exp_matrixrepresents the feature importance matrix obtained from the SVM model.- Each element in
feat_exp_matrixcorresponds to the importance or weight assigned to a specific feature (in this case, the correlation between different brain regions). - The shape of
feat_exp_matrixis(64, 64), indicating that it is a square matrix where each row and column correspond to one of the 64 brain regions.
feat_exp_matrix = correlation_measure.inverse_transform(best_svc_model.coef_)[0]
# Define a threshold to visualize only higher values
threshold = 0.05 # Adjust this threshold as needed
labels = difumo.labels["difumo_names"]
# Replace diagonal with NaN to remove it from the plot
np.fill_diagonal(feat_exp_matrix, np.nan)
# Plot the matrix
plt.figure(figsize=(20, 18)) # Adjust the figure size as needed
plt.imshow(feat_exp_matrix, cmap='viridis', origin='upper', vmin=threshold)
plt.colorbar(label='Correlation Strength', fraction=0.046, pad=0.04) # Adjust color bar position
# Add labels to the ticks
plt.xticks(ticks=range(len(labels)), labels=labels, rotation=90)
plt.yticks(ticks=range(len(labels)), labels=labels)
# Add title
plt.title('Connectivity Matrix')
# Show the plot
plt.tight_layout() # Adjust layout to prevent overlap
plt.show()
This code iterates over the correlation matrix and prints the correlation values between different brain regions that exceed the specified threshold.
Iteration Over the Matrix:
- The code uses nested loops to iterate over each element of the correlation matrix.
- The outer loop (
for i in range(len(labels))) iterates over the rows of the matrix, representing one brain region. - The inner loop (
for j in range(len(labels))) iterates over the columns of the matrix, representing another brain region.
Condition for Printing:
- Within the nested loops, the code checks if the current element is not on the diagonal (i.e.,
i != j) to avoid printing self-correlations. - It also checks if the correlation value (
feat_exp_matrix[i, j]) is greater than or equal to the specified threshold.
- Within the nested loops, the code checks if the current element is not on the diagonal (i.e.,
Printing Correlation Values:
- If both conditions are met, the code prints the names of the two brain regions (
labels[i]andlabels[j]) along with their correlation value.
- If both conditions are met, the code prints the names of the two brain regions (
# Iterate over the correlation matrix and print the values
for i in range(len(labels)):
for j in range(len(labels)):
if i != j and feat_exp_matrix[i, j] >= threshold:
print(f"{labels[i]} - {labels[j]}: {feat_exp_matrix[i, j]}")
Superior frontal sulcus - Cingulate cortex posterior: 0.024572098783108988 Superior frontal sulcus - Anterior Cingulate Cortex: 0.021465588250447396 Fusiform gyrus - Insula antero-superior: 0.02396235930523669 Fusiform gyrus - ventricles: 0.02796524345460276 Fusiform gyrus - Precuneus superior: 0.03954051566003608 Fusiform gyrus - Anterior Cingulate Cortex: 0.045386443894684894 Fusiform gyrus - Inferior occipital gyrus: 0.0384588487547811 Fusiform gyrus - Superior rostral gyrus: 0.022349567484306575 Fusiform gyrus - Superior parietal lobule: 0.02233224840085746 Calcarine cortex posterior - Superior occipital gyrus: 0.020087867115944312 Calcarine cortex posterior - Planum polare: 0.02173601249891338 Calcarine cortex posterior - Anterior Cingulate Cortex: 0.023252548826835674 Calcarine cortex posterior - Inferior occipital gyrus: 0.03493064271441605 Calcarine cortex posterior - Postcentral gyrus inferior: 0.02340693154085293 Cingulate cortex posterior - Superior frontal sulcus: 0.024572098783108988 Cingulate cortex posterior - Insula antero-superior: 0.05058447817292083 Cingulate cortex posterior - Planum temporale: 0.02355296976070756 Cingulate cortex posterior - Cerebellum Crus II: 0.022177604284786823 Cingulate cortex posterior - Superior parts of Postcentral and Precentral gyri: 0.03064682538331201 Cingulate cortex posterior - Paracentral gyrus RH: 0.021084718617357733 Cingulate cortex posterior - Superior frontal gyrus medial: 0.026068121887529237 Cingulate cortex posterior - Precuneus superior: 0.02419459431626161 Cingulate cortex posterior - Cerebellum I-V: 0.020881204198076604 Cingulate cortex posterior - Anterior Cingulate Cortex: 0.062397011665541194 Cingulate cortex posterior - Cingulate gyrus mid-anterior: 0.03326612481148376 Cingulate cortex posterior - Superior parietal lobule posterior: 0.03285212200674496 Cingulate cortex posterior - Supramarginal gyrus: 0.029963033278403193 Cingulate cortex posterior - Precentral gyrus superior: 0.049258771692586 Cingulate cortex posterior - Postcentral gyrus inferior: 0.024647388980006627 Cingulate cortex posterior - Callosomarginal sulcus: 0.0257537449593733 Cingulate cortex posterior - Heschl’s gyrus: 0.02391163019823206 Cingulate cortex posterior - Intraparietal sulcus RH: 0.028902029623437464 Cingulate cortex posterior - Postcentral gyrus LH: 0.02784968919469567 Cingulate cortex posterior - Middle frontal gyrus: 0.06502743674014841 Cingulate cortex posterior - Precuneus anterior: 0.022625033151112504 Cingulate cortex posterior - Superior parietal lobule: 0.03886337923618291 Cingulate cortex posterior - Middle frontal gyrus anterior: 0.04528895912600043 Cingulate cortex posterior - Superior frontal gyrus: 0.025950517569564447 Parieto-occipital sulcus superior - Cerebellum Crus II: 0.021070315387326524 Parieto-occipital sulcus superior - Angular gyrus superior: 0.030308742152800328 Parieto-occipital sulcus superior - Parieto-occipital sulcus anterior: 0.023607354548723716 Parieto-occipital sulcus superior - Angular gyrus inferior: 0.02703270776103122 Insula antero-superior - Fusiform gyrus: 0.02396235930523669 Insula antero-superior - Cingulate cortex posterior: 0.05058447817292083 Insula antero-superior - Superior temporal sulcus with angular gyrus: 0.02760037967197863 Insula antero-superior - Superior occipital gyrus: 0.03591984314088936 Insula antero-superior - Cingulate gyrus mid-posterior: 0.02933409216686269 Insula antero-superior - Fusiform gyrus posterior: 0.023183813976228033 Insula antero-superior - Precuneus superior: 0.024402257463852276 Insula antero-superior - Planum polare: 0.03672278915149496 Insula antero-superior - Parieto-occipital sulcus middle: 0.02301783148594108 Insula antero-superior - Descending occipital gyrus: 0.02196218059729364 Insula antero-superior - Dorsomedial prefrontal cortex antero-superior: 0.03131560902469789 Insula antero-superior - Heschl’s gyrus: 0.027731300877050884 Insula antero-superior - Occipital pole: 0.03623730667119611 Insula antero-superior - Parieto-occipital sulcus anterior: 0.03216019344374006 Superior temporal sulcus with angular gyrus - Insula antero-superior: 0.02760037967197863 Superior temporal sulcus with angular gyrus - Anterior Cingulate Cortex: 0.0765332938457802 Superior temporal sulcus with angular gyrus - Middle frontal gyrus anterior: 0.024385124449745502 Planum temporale - Cingulate cortex posterior: 0.02355296976070756 Planum temporale - Planum polare: 0.03234049345887994 Planum temporale - Anterior Cingulate Cortex: 0.027083248055962406 Planum temporale - Calcarine sulcus anterior: 0.02241501020202332 Planum temporale - Lingual gyrus anterior: 0.02238984639331046 Planum temporale - Callosomarginal sulcus: 0.03430052331003754 Planum temporale - Superior parietal lobule: 0.025535581662185586 Cerebellum Crus II - Cingulate cortex posterior: 0.022177604284786823 Cerebellum Crus II - Parieto-occipital sulcus superior: 0.021070315387326524 Cerebellum Crus II - Cingulate gyrus mid-posterior: 0.0277795058751471 Cerebellum Crus II - ventricles: 0.04576617978241995 Cerebellum Crus II - Precuneus superior: 0.05440219080449031 Cerebellum Crus II - Anterior Cingulate Cortex: 0.06602582572506618 Cerebellum Crus II - Superior parietal lobule posterior: 0.02334336375970296 Cerebellum Crus II - Superior rostral gyrus: 0.058192245755569534 Cerebellum Crus II - Intraparietal sulcus: 0.05054476853062033 Cerebellum Crus II - Angular gyrus superior: 0.02767980777222678 Cerebellum Crus II - Dorsomedial prefrontal cortex antero-superior: 0.049490324632080425 Cerebellum Crus II - Occipital pole: 0.02112125326645773 Cerebellum Crus II - Middle frontal gyrus: 0.023670459579349594 Cerebellum Crus II - Inferior frontal gyrus: 0.03419325331063984 Cerebellum Crus II - Superior parietal lobule: 0.033068794303003315 Cerebellum Crus II - Middle frontal gyrus anterior: 0.029828868717955405 Cerebellum Crus II - Angular gyrus inferior: 0.04835559921860546 Cerebellum Crus II - Superior frontal gyrus: 0.03335105687063897 Cerebellum Crus II - Caudate: 0.03953927947846987 Superior parts of Postcentral and Precentral gyri - Cingulate cortex posterior: 0.03064682538331201 Superior parts of Postcentral and Precentral gyri - ventricles: 0.023197163564488917 Superior parts of Postcentral and Precentral gyri - Anterior Cingulate Cortex: 0.02742860628072923 Superior parts of Postcentral and Precentral gyri - Superior rostral gyrus: 0.030987828242049074 Superior parts of Postcentral and Precentral gyri - Postcentral gyrus inferior: 0.03485450968865003 Superior parts of Postcentral and Precentral gyri - Angular gyrus inferior: 0.025535067838636967 Transverse sinus - ventricles: 0.05136524717836236 Transverse sinus - Precuneus superior: 0.03594439259141224 Transverse sinus - Anterior Cingulate Cortex: 0.036856913928931666 Transverse sinus - Superior parietal lobule posterior: 0.02171026291796746 Transverse sinus - Inferior occipital gyrus: 0.02839749217180095 Transverse sinus - Superior rostral gyrus: 0.022738215188974207 Transverse sinus - Middle frontal gyrus: 0.024399486958743388 Transverse sinus - Superior parietal lobule: 0.021766236572771817 Paracentral gyrus RH - Cingulate cortex posterior: 0.021084718617357733 Paracentral gyrus RH - Anterior Cingulate Cortex: 0.02908335971792618 Paracentral gyrus RH - Superior rostral gyrus: 0.0221831201574644 Paracentral gyrus RH - Postcentral gyrus inferior: 0.04293328887233179 Paracentral gyrus RH - Callosomarginal sulcus: 0.023974255436625347 Paracentral gyrus RH - Superior parietal lobule: 0.03029986418634357 Superior occipital gyrus - Calcarine cortex posterior: 0.020087867115944312 Superior occipital gyrus - Insula antero-superior: 0.03591984314088936 Superior occipital gyrus - ventricles: 0.049594188120890156 Superior occipital gyrus - Precuneus superior: 0.02606410094555466 Superior occipital gyrus - Planum polare: 0.038123891003711316 Superior occipital gyrus - Cingulate gyrus mid-anterior: 0.02039329830010903 Superior occipital gyrus - Inferior occipital gyrus: 0.0370633435660378 Superior occipital gyrus - Calcarine sulcus anterior: 0.027290789317706923 Superior occipital gyrus - Lingual gyrus anterior: 0.02792749186827548 Superior occipital gyrus - Supramarginal gyrus: 0.034661973147977275 Superior occipital gyrus - Intraparietal sulcus LH: 0.032770214482988586 Superior occipital gyrus - Postcentral gyrus inferior: 0.04086048533954996 Superior occipital gyrus - Intraparietal sulcus RH: 0.023097693628212367 Superior occipital gyrus - Precuneus anterior: 0.024401876794959258 Superior occipital gyrus - Superior parietal lobule: 0.021764185826580323 Superior occipital gyrus - Cuneus: 0.020790559620870244 Cingulate gyrus mid-posterior - Insula antero-superior: 0.02933409216686269 Cingulate gyrus mid-posterior - Cerebellum Crus II: 0.0277795058751471 Cingulate gyrus mid-posterior - Superior frontal gyrus medial: 0.02183343040878081 Cingulate gyrus mid-posterior - Precuneus superior: 0.020723692055098074 Cingulate gyrus mid-posterior - Anterior Cingulate Cortex: 0.04311061431294372 Cingulate gyrus mid-posterior - Superior parietal lobule posterior: 0.021309014001769187 Cingulate gyrus mid-posterior - Precentral gyrus superior: 0.0343959786470594 Cingulate gyrus mid-posterior - Middle frontal gyrus: 0.033213965474690396 Cingulate gyrus mid-posterior - Middle frontal gyrus anterior: 0.044352444266239924 ventricles - Fusiform gyrus: 0.02796524345460276 ventricles - Cerebellum Crus II: 0.04576617978241995 ventricles - Superior parts of Postcentral and Precentral gyri: 0.023197163564488917 ventricles - Transverse sinus: 0.05136524717836236 ventricles - Superior occipital gyrus: 0.049594188120890156 ventricles - Fusiform gyrus posterior: 0.03799163040473566 ventricles - Precuneus superior: 0.06600046961879227 ventricles - Descending occipital gyrus: 0.02608644504593679 ventricles - Superior parietal lobule posterior: 0.037001743729341195 ventricles - Superior rostral gyrus: 0.03535059522736483 ventricles - Supramarginal gyrus: 0.020440767154152134 ventricles - Dorsomedial prefrontal cortex antero-superior: 0.02858011598558558 ventricles - Precentral gyrus superior: 0.03446063137939254 ventricles - Lateral occipital cortex: 0.02911508843839884 ventricles - Occipital pole: 0.02573905875655913 ventricles - Inferior frontal sulcus: 0.023568025890305003 ventricles - Middle frontal gyrus: 0.031211786863893705 ventricles - Inferior frontal gyrus: 0.027911784553507814 ventricles - Superior occipital sulcus: 0.030669375547281743 ventricles - Superior parietal lobule: 0.04673274765279683 ventricles - Angular gyrus inferior: 0.02835752570660184 Fusiform gyrus posterior - Insula antero-superior: 0.023183813976228033 Fusiform gyrus posterior - ventricles: 0.03799163040473566 Fusiform gyrus posterior - Planum polare: 0.024169757207942972 Fusiform gyrus posterior - Anterior Cingulate Cortex: 0.04679415991875026 Fusiform gyrus posterior - Superior parietal lobule posterior: 0.02551258444126279 Fusiform gyrus posterior - Intraparietal sulcus: 0.02350877667497858 Fusiform gyrus posterior - Intraparietal sulcus LH: 0.034994072803199765 Fusiform gyrus posterior - Postcentral gyrus inferior: 0.02981608001737897 Fusiform gyrus posterior - Intraparietal sulcus RH: 0.038477932332586055 Fusiform gyrus posterior - Middle frontal gyrus: 0.028814124875484674 Fusiform gyrus posterior - Inferior frontal gyrus: 0.02195607184723937 Fusiform gyrus posterior - Superior parietal lobule: 0.034582976855749806 Superior frontal gyrus medial - Cingulate cortex posterior: 0.026068121887529237 Superior frontal gyrus medial - Cingulate gyrus mid-posterior: 0.02183343040878081 Superior frontal gyrus medial - Superior rostral gyrus: 0.026662241041122196 Superior frontal gyrus medial - Occipital pole: 0.024023702133437023 Superior frontal gyrus medial - Angular gyrus inferior: 0.03011896462801947 Precuneus superior - Fusiform gyrus: 0.03954051566003608 Precuneus superior - Cingulate cortex posterior: 0.02419459431626161 Precuneus superior - Insula antero-superior: 0.024402257463852276 Precuneus superior - Cerebellum Crus II: 0.05440219080449031 Precuneus superior - Transverse sinus: 0.03594439259141224 Precuneus superior - Superior occipital gyrus: 0.02606410094555466 Precuneus superior - Cingulate gyrus mid-posterior: 0.020723692055098074 Precuneus superior - ventricles: 0.06600046961879227 Precuneus superior - Planum polare: 0.03241718632461819 Precuneus superior - Cerebellum I-V: 0.03231158091746448 Precuneus superior - Anterior Cingulate Cortex: 0.03730893120149659 Precuneus superior - Descending occipital gyrus: 0.03788118417699235 Precuneus superior - Superior parietal lobule posterior: 0.03266142220828525 Precuneus superior - Intraparietal sulcus: 0.031236195151297594 Precuneus superior - Lingual gyrus anterior: 0.02935282419780551 Precuneus superior - Angular gyrus superior: 0.028521117598547863 Precuneus superior - Intraparietal sulcus LH: 0.03827355441449212 Precuneus superior - Precentral gyrus superior: 0.04234080276140227 Precuneus superior - Postcentral gyrus inferior: 0.0355309906623379 Precuneus superior - Lateral occipital cortex: 0.028672031130020727 Precuneus superior - Thalamus: 0.030030480813967197 Precuneus superior - Intraparietal sulcus RH: 0.046684946546806334 Precuneus superior - Inferior frontal sulcus: 0.0357672156024464 Precuneus superior - Middle frontal gyrus: 0.04456032588272195 Precuneus superior - Inferior frontal gyrus: 0.028461290740366612 Precuneus superior - Parieto-occipital sulcus anterior: 0.04806776964702013 Precuneus superior - Precuneus anterior: 0.02522333553558079 Precuneus superior - Lingual gyrus: 0.027303023633692226 Precuneus superior - Superior occipital sulcus: 0.04091763043551805 Precuneus superior - Superior parietal lobule: 0.02593231159069462 Precuneus superior - Central sulcus: 0.02569562202543034 Planum polare - Calcarine cortex posterior: 0.02173601249891338 Planum polare - Insula antero-superior: 0.03672278915149496 Planum polare - Planum temporale: 0.03234049345887994 Planum polare - Superior occipital gyrus: 0.038123891003711316 Planum polare - Fusiform gyrus posterior: 0.024169757207942972 Planum polare - Precuneus superior: 0.03241718632461819 Planum polare - Parieto-occipital sulcus middle: 0.027501497062733162 Planum polare - Descending occipital gyrus: 0.028782746028048225 Planum polare - Superior rostral gyrus: 0.023853519805432356 Planum polare - Calcarine sulcus anterior: 0.022077519520385832 Planum polare - Supramarginal gyrus: 0.03492145081009072 Planum polare - Dorsomedial prefrontal cortex antero-superior: 0.024011761625725228 Planum polare - Precentral gyrus superior: 0.021456947599495287 Planum polare - Lateral occipital cortex: 0.022350785947408126 Planum polare - Callosomarginal sulcus: 0.031697891866195156 Planum polare - Heschl’s gyrus: 0.02889142656799318 Planum polare - Occipital pole: 0.03305310738080194 Planum polare - Inferior frontal sulcus: 0.02148720265240705 Planum polare - Inferior frontal gyrus: 0.03373601911821551 Planum polare - Parieto-occipital sulcus anterior: 0.020937489640201805 Planum polare - Precuneus anterior: 0.024544242121798045 Planum polare - Superior parietal lobule: 0.027137660167613417 Parieto-occipital sulcus middle - Insula antero-superior: 0.02301783148594108 Parieto-occipital sulcus middle - Planum polare: 0.027501497062733162 Parieto-occipital sulcus middle - Supramarginal gyrus: 0.03296396068338635 Parieto-occipital sulcus middle - Postcentral gyrus inferior: 0.03559173319639446 Cerebellum I-V - Cingulate cortex posterior: 0.020881204198076604 Cerebellum I-V - Precuneus superior: 0.03231158091746448 Cerebellum I-V - Anterior Cingulate Cortex: 0.05174277875696272 Cerebellum I-V - Superior rostral gyrus: 0.025607445238538553 Cerebellum I-V - Supramarginal gyrus: 0.03169887527326673 Cerebellum I-V - Dorsomedial prefrontal cortex antero-superior: 0.03258635161218133 Cerebellum I-V - Postcentral gyrus inferior: 0.04066941987581136 Cerebellum I-V - Occipital pole: 0.025946388219448096 Cerebellum I-V - Inferior frontal gyrus: 0.041376799196504735 Cerebellum I-V - Superior parietal lobule: 0.02367009856418632 Cerebellum I-V - Angular gyrus inferior: 0.03188264567912002 Cerebellum I-V - Superior frontal gyrus: 0.0419723378386445 Anterior Cingulate Cortex - Superior frontal sulcus: 0.021465588250447396 Anterior Cingulate Cortex - Fusiform gyrus: 0.045386443894684894 Anterior Cingulate Cortex - Calcarine cortex posterior: 0.023252548826835674 Anterior Cingulate Cortex - Cingulate cortex posterior: 0.062397011665541194 Anterior Cingulate Cortex - Superior temporal sulcus with angular gyrus: 0.0765332938457802 Anterior Cingulate Cortex - Planum temporale: 0.027083248055962406 Anterior Cingulate Cortex - Cerebellum Crus II: 0.06602582572506618 Anterior Cingulate Cortex - Superior parts of Postcentral and Precentral gyri: 0.02742860628072923 Anterior Cingulate Cortex - Transverse sinus: 0.036856913928931666 Anterior Cingulate Cortex - Paracentral gyrus RH: 0.02908335971792618 Anterior Cingulate Cortex - Cingulate gyrus mid-posterior: 0.04311061431294372 Anterior Cingulate Cortex - Fusiform gyrus posterior: 0.04679415991875026 Anterior Cingulate Cortex - Precuneus superior: 0.03730893120149659 Anterior Cingulate Cortex - Cerebellum I-V: 0.05174277875696272 Anterior Cingulate Cortex - Descending occipital gyrus: 0.02794777887501885 Anterior Cingulate Cortex - Putamen: 0.032483297915604004 Anterior Cingulate Cortex - Superior parietal lobule posterior: 0.02003721436021013 Anterior Cingulate Cortex - Superior rostral gyrus: 0.06935571526424762 Anterior Cingulate Cortex - Calcarine sulcus anterior: 0.03858006628516223 Anterior Cingulate Cortex - Intraparietal sulcus: 0.02378593437736036 Anterior Cingulate Cortex - Lingual gyrus anterior: 0.02686299645472237 Anterior Cingulate Cortex - Angular gyrus superior: 0.06006634323374711 Anterior Cingulate Cortex - Dorsomedial prefrontal cortex antero-superior: 0.06346270854892735 Anterior Cingulate Cortex - Postcentral gyrus inferior: 0.044146786388960774 Anterior Cingulate Cortex - Lateral occipital cortex: 0.05337059894066619 Anterior Cingulate Cortex - Paracentral lobule superior: 0.05227124004123872 Anterior Cingulate Cortex - Heschl’s gyrus: 0.05012577054887324 Anterior Cingulate Cortex - Occipital pole: 0.049824228078125914 Anterior Cingulate Cortex - Inferior frontal sulcus: 0.029356860355617548 Anterior Cingulate Cortex - Inferior frontal gyrus: 0.036849526221523085 Anterior Cingulate Cortex - Parieto-occipital sulcus anterior: 0.0344700761083543 Anterior Cingulate Cortex - Superior parietal lobule: 0.030819918149411804 Anterior Cingulate Cortex - Middle frontal gyrus anterior: 0.020839602458621254 Anterior Cingulate Cortex - Angular gyrus inferior: 0.09245993901160833 Anterior Cingulate Cortex - Superior frontal gyrus: 0.027084829406132466 Anterior Cingulate Cortex - Caudate: 0.02546249725542627 Descending occipital gyrus - Insula antero-superior: 0.02196218059729364 Descending occipital gyrus - ventricles: 0.02608644504593679 Descending occipital gyrus - Precuneus superior: 0.03788118417699235 Descending occipital gyrus - Planum polare: 0.028782746028048225 Descending occipital gyrus - Anterior Cingulate Cortex: 0.02794777887501885 Descending occipital gyrus - Inferior occipital gyrus: 0.030683360906194262 Descending occipital gyrus - Supramarginal gyrus: 0.0208093161520854 Descending occipital gyrus - Intraparietal sulcus LH: 0.03198468332317604 Descending occipital gyrus - Intraparietal sulcus RH: 0.033417645402016416 Descending occipital gyrus - Precuneus anterior: 0.0201287728997811 Descending occipital gyrus - Superior parietal lobule: 0.03178937889956278 Putamen - Anterior Cingulate Cortex: 0.032483297915604004 Cingulate gyrus mid-anterior - Cingulate cortex posterior: 0.03326612481148376 Cingulate gyrus mid-anterior - Superior occipital gyrus: 0.02039329830010903 Cingulate gyrus mid-anterior - Occipital pole: 0.02730893310825364 Cingulate gyrus mid-anterior - Parieto-occipital sulcus anterior: 0.02519604290220931 Cingulate gyrus mid-anterior - Angular gyrus inferior: 0.025079464470847954 Superior parietal lobule posterior - Cingulate cortex posterior: 0.03285212200674496 Superior parietal lobule posterior - Cerebellum Crus II: 0.02334336375970296 Superior parietal lobule posterior - Transverse sinus: 0.02171026291796746 Superior parietal lobule posterior - Cingulate gyrus mid-posterior: 0.021309014001769187 Superior parietal lobule posterior - ventricles: 0.037001743729341195 Superior parietal lobule posterior - Fusiform gyrus posterior: 0.02551258444126279 Superior parietal lobule posterior - Precuneus superior: 0.03266142220828525 Superior parietal lobule posterior - Anterior Cingulate Cortex: 0.02003721436021013 Superior parietal lobule posterior - Intraparietal sulcus: 0.02890525653245347 Superior parietal lobule posterior - Inferior frontal gyrus: 0.022761477621522593 Superior parietal lobule posterior - Parieto-occipital sulcus anterior: 0.030758432465090343 Superior parietal lobule posterior - Superior parietal lobule: 0.031198499932633444 Paracentral lobule - Postcentral gyrus inferior: 0.022150753790463378 Paracentral lobule - Paracentral lobule superior: 0.02518066338634169 Inferior occipital gyrus - Fusiform gyrus: 0.0384588487547811 Inferior occipital gyrus - Calcarine cortex posterior: 0.03493064271441605 Inferior occipital gyrus - Transverse sinus: 0.02839749217180095 Inferior occipital gyrus - Superior occipital gyrus: 0.0370633435660378 Inferior occipital gyrus - Descending occipital gyrus: 0.030683360906194262 Inferior occipital gyrus - Calcarine sulcus anterior: 0.03245751543553308 Inferior occipital gyrus - Lingual gyrus anterior: 0.02719952506913034 Inferior occipital gyrus - Intraparietal sulcus LH: 0.029856795546516175 Inferior occipital gyrus - Lateral occipital cortex: 0.024496396931818477 Inferior occipital gyrus - Lingual gyrus: 0.024646760884821664 Inferior occipital gyrus - Superior parietal lobule: 0.03112564712020063 Inferior occipital gyrus - Cuneus: 0.03705204225019097 Superior rostral gyrus - Fusiform gyrus: 0.022349567484306575 Superior rostral gyrus - Cerebellum Crus II: 0.058192245755569534 Superior rostral gyrus - Superior parts of Postcentral and Precentral gyri: 0.030987828242049074 Superior rostral gyrus - Transverse sinus: 0.022738215188974207 Superior rostral gyrus - Paracentral gyrus RH: 0.0221831201574644 Superior rostral gyrus - ventricles: 0.03535059522736483 Superior rostral gyrus - Superior frontal gyrus medial: 0.026662241041122196 Superior rostral gyrus - Planum polare: 0.023853519805432356 Superior rostral gyrus - Cerebellum I-V: 0.025607445238538553 Superior rostral gyrus - Anterior Cingulate Cortex: 0.06935571526424762 Superior rostral gyrus - Middle frontal gyrus anterior: 0.026227363518814092 Superior rostral gyrus - Caudate: 0.02797784006503763 Calcarine sulcus anterior - Planum temporale: 0.02241501020202332 Calcarine sulcus anterior - Superior occipital gyrus: 0.027290789317706923 Calcarine sulcus anterior - Planum polare: 0.022077519520385832 Calcarine sulcus anterior - Anterior Cingulate Cortex: 0.03858006628516223 Calcarine sulcus anterior - Inferior occipital gyrus: 0.03245751543553308 Calcarine sulcus anterior - Postcentral gyrus inferior: 0.021799474743033474 Intraparietal sulcus - Cerebellum Crus II: 0.05054476853062033 Intraparietal sulcus - Fusiform gyrus posterior: 0.02350877667497858 Intraparietal sulcus - Precuneus superior: 0.031236195151297594 Intraparietal sulcus - Anterior Cingulate Cortex: 0.02378593437736036 Intraparietal sulcus - Superior parietal lobule posterior: 0.02890525653245347 Superior parietal lobule anterior - Postcentral gyrus inferior: 0.03965938054801533 Superior parietal lobule anterior - Paracentral lobule superior: 0.03304688068384546 Lingual gyrus anterior - Planum temporale: 0.02238984639331046 Lingual gyrus anterior - Superior occipital gyrus: 0.02792749186827548 Lingual gyrus anterior - Precuneus superior: 0.02935282419780551 Lingual gyrus anterior - Anterior Cingulate Cortex: 0.02686299645472237 Lingual gyrus anterior - Inferior occipital gyrus: 0.02719952506913034 Lingual gyrus anterior - Supramarginal gyrus: 0.021145272760753193 Lingual gyrus anterior - Postcentral gyrus inferior: 0.036551362735338884 Lingual gyrus anterior - Inferior frontal gyrus: 0.020087610069037386 Lingual gyrus anterior - Superior parietal lobule: 0.02340072097978824 Angular gyrus superior - Parieto-occipital sulcus superior: 0.030308742152800328 Angular gyrus superior - Cerebellum Crus II: 0.02767980777222678 Angular gyrus superior - Precuneus superior: 0.028521117598547863 Angular gyrus superior - Anterior Cingulate Cortex: 0.06006634323374711 Angular gyrus superior - Paracentral lobule superior: 0.032054351366451884 Angular gyrus superior - Middle frontal gyrus anterior: 0.034351144989554855 Supramarginal gyrus - Cingulate cortex posterior: 0.029963033278403193 Supramarginal gyrus - Superior occipital gyrus: 0.034661973147977275 Supramarginal gyrus - ventricles: 0.020440767154152134 Supramarginal gyrus - Planum polare: 0.03492145081009072 Supramarginal gyrus - Parieto-occipital sulcus middle: 0.03296396068338635 Supramarginal gyrus - Cerebellum I-V: 0.03169887527326673 Supramarginal gyrus - Descending occipital gyrus: 0.0208093161520854 Supramarginal gyrus - Lingual gyrus anterior: 0.021145272760753193 Supramarginal gyrus - Postcentral gyrus inferior: 0.02073400950361869 Supramarginal gyrus - Occipital pole: 0.03036467959954299 Supramarginal gyrus - Parieto-occipital sulcus anterior: 0.026949615834814616 Supramarginal gyrus - Lingual gyrus: 0.02603890716149865 Supramarginal gyrus - Superior parietal lobule: 0.024296003008624077 Supramarginal gyrus - Central sulcus: 0.02396115759485133 Intraparietal sulcus LH - Superior occipital gyrus: 0.032770214482988586 Intraparietal sulcus LH - Fusiform gyrus posterior: 0.034994072803199765 Intraparietal sulcus LH - Precuneus superior: 0.03827355441449212 Intraparietal sulcus LH - Descending occipital gyrus: 0.03198468332317604 Intraparietal sulcus LH - Inferior occipital gyrus: 0.029856795546516175 Intraparietal sulcus LH - Parieto-occipital sulcus anterior: 0.020036336154243634 Intraparietal sulcus LH - Superior occipital sulcus: 0.03290728257114556 Intraparietal sulcus LH - Superior parietal lobule: 0.026011484081115966 Dorsomedial prefrontal cortex antero-superior - Insula antero-superior: 0.03131560902469789 Dorsomedial prefrontal cortex antero-superior - Cerebellum Crus II: 0.049490324632080425 Dorsomedial prefrontal cortex antero-superior - ventricles: 0.02858011598558558 Dorsomedial prefrontal cortex antero-superior - Planum polare: 0.024011761625725228 Dorsomedial prefrontal cortex antero-superior - Cerebellum I-V: 0.03258635161218133 Dorsomedial prefrontal cortex antero-superior - Anterior Cingulate Cortex: 0.06346270854892735 Dorsomedial prefrontal cortex antero-superior - Paracentral lobule superior: 0.023320696728599842 Dorsomedial prefrontal cortex antero-superior - Heschl’s gyrus: 0.02040101716401565 Dorsomedial prefrontal cortex antero-superior - Occipital pole: 0.02116885867737294 Dorsomedial prefrontal cortex antero-superior - Middle frontal gyrus: 0.0249890332954356 Dorsomedial prefrontal cortex antero-superior - Inferior frontal gyrus: 0.02173752749134353 Dorsomedial prefrontal cortex antero-superior - Middle frontal gyrus anterior: 0.03658093963152918 Dorsomedial prefrontal cortex antero-superior - Angular gyrus inferior: 0.029463169688333714 Precentral gyrus superior - Cingulate cortex posterior: 0.049258771692586 Precentral gyrus superior - Cingulate gyrus mid-posterior: 0.0343959786470594 Precentral gyrus superior - ventricles: 0.03446063137939254 Precentral gyrus superior - Precuneus superior: 0.04234080276140227 Precentral gyrus superior - Planum polare: 0.021456947599495287 Precentral gyrus superior - Intraparietal sulcus RH: 0.02795262295378409 Precentral gyrus superior - Parieto-occipital sulcus anterior: 0.035251581297930684 Precentral gyrus superior - Precuneus anterior: 0.025365419531118615 Postcentral gyrus inferior - Calcarine cortex posterior: 0.02340693154085293 Postcentral gyrus inferior - Cingulate cortex posterior: 0.024647388980006627 Postcentral gyrus inferior - Superior parts of Postcentral and Precentral gyri: 0.03485450968865003 Postcentral gyrus inferior - Paracentral gyrus RH: 0.04293328887233179 Postcentral gyrus inferior - Superior occipital gyrus: 0.04086048533954996 Postcentral gyrus inferior - Fusiform gyrus posterior: 0.02981608001737897 Postcentral gyrus inferior - Precuneus superior: 0.0355309906623379 Postcentral gyrus inferior - Parieto-occipital sulcus middle: 0.03559173319639446 Postcentral gyrus inferior - Cerebellum I-V: 0.04066941987581136 Postcentral gyrus inferior - Anterior Cingulate Cortex: 0.044146786388960774 Postcentral gyrus inferior - Paracentral lobule: 0.022150753790463378 Postcentral gyrus inferior - Calcarine sulcus anterior: 0.021799474743033474 Postcentral gyrus inferior - Superior parietal lobule anterior: 0.03965938054801533 Postcentral gyrus inferior - Lingual gyrus anterior: 0.036551362735338884 Postcentral gyrus inferior - Supramarginal gyrus: 0.02073400950361869 Postcentral gyrus inferior - Lateral occipital cortex: 0.03751686739724017 Postcentral gyrus inferior - Callosomarginal sulcus: 0.04948815192787895 Postcentral gyrus inferior - Paracentral lobule superior: 0.02253202493899083 Postcentral gyrus inferior - Heschl’s gyrus: 0.020592093459780844 Postcentral gyrus inferior - Occipital pole: 0.022539831661802442 Postcentral gyrus inferior - Postcentral gyrus LH: 0.02684323861047421 Postcentral gyrus inferior - Parieto-occipital sulcus anterior: 0.02298512217257711 Postcentral gyrus inferior - Precuneus anterior: 0.040395361774852485 Postcentral gyrus inferior - Lingual gyrus: 0.0273289776609743 Postcentral gyrus inferior - Superior parietal lobule: 0.035668245270909074 Lateral occipital cortex - ventricles: 0.02911508843839884 Lateral occipital cortex - Precuneus superior: 0.028672031130020727 Lateral occipital cortex - Planum polare: 0.022350785947408126 Lateral occipital cortex - Anterior Cingulate Cortex: 0.05337059894066619 Lateral occipital cortex - Inferior occipital gyrus: 0.024496396931818477 Lateral occipital cortex - Postcentral gyrus inferior: 0.03751686739724017 Lateral occipital cortex - Inferior frontal gyrus: 0.029438439311844932 Lateral occipital cortex - Superior parietal lobule: 0.030036046344906323 Callosomarginal sulcus - Cingulate cortex posterior: 0.0257537449593733 Callosomarginal sulcus - Planum temporale: 0.03430052331003754 Callosomarginal sulcus - Paracentral gyrus RH: 0.023974255436625347 Callosomarginal sulcus - Planum polare: 0.031697891866195156 Callosomarginal sulcus - Postcentral gyrus inferior: 0.04948815192787895 Callosomarginal sulcus - Heschl’s gyrus: 0.02537081234964843 Callosomarginal sulcus - Inferior frontal gyrus: 0.02090353579863594 Callosomarginal sulcus - Central sulcus: 0.02741210185858165 Paracentral lobule superior - Anterior Cingulate Cortex: 0.05227124004123872 Paracentral lobule superior - Paracentral lobule: 0.02518066338634169 Paracentral lobule superior - Superior parietal lobule anterior: 0.03304688068384546 Paracentral lobule superior - Angular gyrus superior: 0.032054351366451884 Paracentral lobule superior - Dorsomedial prefrontal cortex antero-superior: 0.023320696728599842 Paracentral lobule superior - Postcentral gyrus inferior: 0.02253202493899083 Paracentral lobule superior - Inferior frontal gyrus: 0.031733007971362456 Paracentral lobule superior - Angular gyrus inferior: 0.031878716530771456 Paracentral lobule superior - Superior frontal gyrus: 0.02789240584228514 Heschl’s gyrus - Cingulate cortex posterior: 0.02391163019823206 Heschl’s gyrus - Insula antero-superior: 0.027731300877050884 Heschl’s gyrus - Planum polare: 0.02889142656799318 Heschl’s gyrus - Anterior Cingulate Cortex: 0.05012577054887324 Heschl’s gyrus - Dorsomedial prefrontal cortex antero-superior: 0.02040101716401565 Heschl’s gyrus - Postcentral gyrus inferior: 0.020592093459780844 Heschl’s gyrus - Callosomarginal sulcus: 0.02537081234964843 Heschl’s gyrus - Occipital pole: 0.02093471800586097 Heschl’s gyrus - Superior parietal lobule: 0.028214433524183746 Occipital pole - Insula antero-superior: 0.03623730667119611 Occipital pole - Cerebellum Crus II: 0.02112125326645773 Occipital pole - ventricles: 0.02573905875655913 Occipital pole - Superior frontal gyrus medial: 0.024023702133437023 Occipital pole - Planum polare: 0.03305310738080194 Occipital pole - Cerebellum I-V: 0.025946388219448096 Occipital pole - Anterior Cingulate Cortex: 0.049824228078125914 Occipital pole - Cingulate gyrus mid-anterior: 0.02730893310825364 Occipital pole - Supramarginal gyrus: 0.03036467959954299 Occipital pole - Dorsomedial prefrontal cortex antero-superior: 0.02116885867737294 Occipital pole - Postcentral gyrus inferior: 0.022539831661802442 Occipital pole - Heschl’s gyrus: 0.02093471800586097 Occipital pole - Superior frontal gyrus: 0.02117279894618387 Thalamus - Precuneus superior: 0.030030480813967197 Thalamus - Inferior frontal gyrus: 0.020192605859804754 Thalamus - Superior parietal lobule: 0.02207833349067751 Intraparietal sulcus RH - Cingulate cortex posterior: 0.028902029623437464 Intraparietal sulcus RH - Superior occipital gyrus: 0.023097693628212367 Intraparietal sulcus RH - Fusiform gyrus posterior: 0.038477932332586055 Intraparietal sulcus RH - Precuneus superior: 0.046684946546806334 Intraparietal sulcus RH - Descending occipital gyrus: 0.033417645402016416 Intraparietal sulcus RH - Precentral gyrus superior: 0.02795262295378409 Intraparietal sulcus RH - Parieto-occipital sulcus anterior: 0.042722599653188795 Intraparietal sulcus RH - Precuneus anterior: 0.025936511307235764 Intraparietal sulcus RH - Superior occipital sulcus: 0.022252953139385707 Intraparietal sulcus RH - Superior parietal lobule: 0.022663290681155666 Inferior frontal sulcus - ventricles: 0.023568025890305003 Inferior frontal sulcus - Precuneus superior: 0.0357672156024464 Inferior frontal sulcus - Planum polare: 0.02148720265240705 Inferior frontal sulcus - Anterior Cingulate Cortex: 0.029356860355617548 Postcentral gyrus LH - Cingulate cortex posterior: 0.02784968919469567 Postcentral gyrus LH - Postcentral gyrus inferior: 0.02684323861047421 Postcentral gyrus LH - Superior parietal lobule: 0.030010498406140368 Middle frontal gyrus - Cingulate cortex posterior: 0.06502743674014841 Middle frontal gyrus - Cerebellum Crus II: 0.023670459579349594 Middle frontal gyrus - Transverse sinus: 0.024399486958743388 Middle frontal gyrus - Cingulate gyrus mid-posterior: 0.033213965474690396 Middle frontal gyrus - ventricles: 0.031211786863893705 Middle frontal gyrus - Fusiform gyrus posterior: 0.028814124875484674 Middle frontal gyrus - Precuneus superior: 0.04456032588272195 Middle frontal gyrus - Dorsomedial prefrontal cortex antero-superior: 0.0249890332954356 Middle frontal gyrus - Parieto-occipital sulcus anterior: 0.03989216578300447 Middle frontal gyrus - Precuneus anterior: 0.022173912317855936 Middle frontal gyrus - Angular gyrus inferior: 0.03560446296264776 Inferior frontal gyrus - Cerebellum Crus II: 0.03419325331063984 Inferior frontal gyrus - ventricles: 0.027911784553507814 Inferior frontal gyrus - Fusiform gyrus posterior: 0.02195607184723937 Inferior frontal gyrus - Precuneus superior: 0.028461290740366612 Inferior frontal gyrus - Planum polare: 0.03373601911821551 Inferior frontal gyrus - Cerebellum I-V: 0.041376799196504735 Inferior frontal gyrus - Anterior Cingulate Cortex: 0.036849526221523085 Inferior frontal gyrus - Superior parietal lobule posterior: 0.022761477621522593 Inferior frontal gyrus - Lingual gyrus anterior: 0.020087610069037386 Inferior frontal gyrus - Dorsomedial prefrontal cortex antero-superior: 0.02173752749134353 Inferior frontal gyrus - Lateral occipital cortex: 0.029438439311844932 Inferior frontal gyrus - Callosomarginal sulcus: 0.02090353579863594 Inferior frontal gyrus - Paracentral lobule superior: 0.031733007971362456 Inferior frontal gyrus - Thalamus: 0.020192605859804754 Inferior frontal gyrus - Superior parietal lobule: 0.020854332879218188 Inferior frontal gyrus - Middle frontal gyrus anterior: 0.024239411217934374 Inferior frontal gyrus - Caudate: 0.026291502318687574 Parieto-occipital sulcus anterior - Parieto-occipital sulcus superior: 0.023607354548723716 Parieto-occipital sulcus anterior - Insula antero-superior: 0.03216019344374006 Parieto-occipital sulcus anterior - Precuneus superior: 0.04806776964702013 Parieto-occipital sulcus anterior - Planum polare: 0.020937489640201805 Parieto-occipital sulcus anterior - Anterior Cingulate Cortex: 0.0344700761083543 Parieto-occipital sulcus anterior - Cingulate gyrus mid-anterior: 0.02519604290220931 Parieto-occipital sulcus anterior - Superior parietal lobule posterior: 0.030758432465090343 Parieto-occipital sulcus anterior - Supramarginal gyrus: 0.026949615834814616 Parieto-occipital sulcus anterior - Intraparietal sulcus LH: 0.020036336154243634 Parieto-occipital sulcus anterior - Precentral gyrus superior: 0.035251581297930684 Parieto-occipital sulcus anterior - Postcentral gyrus inferior: 0.02298512217257711 Parieto-occipital sulcus anterior - Intraparietal sulcus RH: 0.042722599653188795 Parieto-occipital sulcus anterior - Middle frontal gyrus: 0.03989216578300447 Parieto-occipital sulcus anterior - Precuneus anterior: 0.029060289390138185 Parieto-occipital sulcus anterior - Superior parietal lobule: 0.03138566574199083 Parieto-occipital sulcus anterior - Middle frontal gyrus anterior: 0.03060294897665207 Precuneus anterior - Cingulate cortex posterior: 0.022625033151112504 Precuneus anterior - Superior occipital gyrus: 0.024401876794959258 Precuneus anterior - Precuneus superior: 0.02522333553558079 Precuneus anterior - Planum polare: 0.024544242121798045 Precuneus anterior - Descending occipital gyrus: 0.0201287728997811 Precuneus anterior - Precentral gyrus superior: 0.025365419531118615 Precuneus anterior - Postcentral gyrus inferior: 0.040395361774852485 Precuneus anterior - Intraparietal sulcus RH: 0.025936511307235764 Precuneus anterior - Middle frontal gyrus: 0.022173912317855936 Precuneus anterior - Parieto-occipital sulcus anterior: 0.029060289390138185 Precuneus anterior - Superior parietal lobule: 0.03130809252407984 Precuneus anterior - Central sulcus: 0.027718512718858737 Lingual gyrus - Precuneus superior: 0.027303023633692226 Lingual gyrus - Inferior occipital gyrus: 0.024646760884821664 Lingual gyrus - Supramarginal gyrus: 0.02603890716149865 Lingual gyrus - Postcentral gyrus inferior: 0.0273289776609743 Superior occipital sulcus - ventricles: 0.030669375547281743 Superior occipital sulcus - Precuneus superior: 0.04091763043551805 Superior occipital sulcus - Intraparietal sulcus LH: 0.03290728257114556 Superior occipital sulcus - Intraparietal sulcus RH: 0.022252953139385707 Superior occipital sulcus - Superior parietal lobule: 0.037625220218815696 Superior parietal lobule - Fusiform gyrus: 0.02233224840085746 Superior parietal lobule - Cingulate cortex posterior: 0.03886337923618291 Superior parietal lobule - Planum temporale: 0.025535581662185586 Superior parietal lobule - Cerebellum Crus II: 0.033068794303003315 Superior parietal lobule - Transverse sinus: 0.021766236572771817 Superior parietal lobule - Paracentral gyrus RH: 0.03029986418634357 Superior parietal lobule - Superior occipital gyrus: 0.021764185826580323 Superior parietal lobule - ventricles: 0.04673274765279683 Superior parietal lobule - Fusiform gyrus posterior: 0.034582976855749806 Superior parietal lobule - Precuneus superior: 0.02593231159069462 Superior parietal lobule - Planum polare: 0.027137660167613417 Superior parietal lobule - Cerebellum I-V: 0.02367009856418632 Superior parietal lobule - Anterior Cingulate Cortex: 0.030819918149411804 Superior parietal lobule - Descending occipital gyrus: 0.03178937889956278 Superior parietal lobule - Superior parietal lobule posterior: 0.031198499932633444 Superior parietal lobule - Inferior occipital gyrus: 0.03112564712020063 Superior parietal lobule - Lingual gyrus anterior: 0.02340072097978824 Superior parietal lobule - Supramarginal gyrus: 0.024296003008624077 Superior parietal lobule - Intraparietal sulcus LH: 0.026011484081115966 Superior parietal lobule - Postcentral gyrus inferior: 0.035668245270909074 Superior parietal lobule - Lateral occipital cortex: 0.030036046344906323 Superior parietal lobule - Heschl’s gyrus: 0.028214433524183746 Superior parietal lobule - Thalamus: 0.02207833349067751 Superior parietal lobule - Intraparietal sulcus RH: 0.022663290681155666 Superior parietal lobule - Postcentral gyrus LH: 0.030010498406140368 Superior parietal lobule - Inferior frontal gyrus: 0.020854332879218188 Superior parietal lobule - Parieto-occipital sulcus anterior: 0.03138566574199083 Superior parietal lobule - Precuneus anterior: 0.03130809252407984 Superior parietal lobule - Superior occipital sulcus: 0.037625220218815696 Superior parietal lobule - Central sulcus: 0.024475610625438158 Middle frontal gyrus anterior - Cingulate cortex posterior: 0.04528895912600043 Middle frontal gyrus anterior - Superior temporal sulcus with angular gyrus: 0.024385124449745502 Middle frontal gyrus anterior - Cerebellum Crus II: 0.029828868717955405 Middle frontal gyrus anterior - Cingulate gyrus mid-posterior: 0.044352444266239924 Middle frontal gyrus anterior - Anterior Cingulate Cortex: 0.020839602458621254 Middle frontal gyrus anterior - Superior rostral gyrus: 0.026227363518814092 Middle frontal gyrus anterior - Angular gyrus superior: 0.034351144989554855 Middle frontal gyrus anterior - Dorsomedial prefrontal cortex antero-superior: 0.03658093963152918 Middle frontal gyrus anterior - Inferior frontal gyrus: 0.024239411217934374 Middle frontal gyrus anterior - Parieto-occipital sulcus anterior: 0.03060294897665207 Middle frontal gyrus anterior - Angular gyrus inferior: 0.047654154499829834 Middle frontal gyrus anterior - Superior frontal gyrus: 0.03203904814356154 Angular gyrus inferior - Parieto-occipital sulcus superior: 0.02703270776103122 Angular gyrus inferior - Cerebellum Crus II: 0.04835559921860546 Angular gyrus inferior - Superior parts of Postcentral and Precentral gyri: 0.025535067838636967 Angular gyrus inferior - ventricles: 0.02835752570660184 Angular gyrus inferior - Superior frontal gyrus medial: 0.03011896462801947 Angular gyrus inferior - Cerebellum I-V: 0.03188264567912002 Angular gyrus inferior - Anterior Cingulate Cortex: 0.09245993901160833 Angular gyrus inferior - Cingulate gyrus mid-anterior: 0.025079464470847954 Angular gyrus inferior - Dorsomedial prefrontal cortex antero-superior: 0.029463169688333714 Angular gyrus inferior - Paracentral lobule superior: 0.031878716530771456 Angular gyrus inferior - Middle frontal gyrus: 0.03560446296264776 Angular gyrus inferior - Middle frontal gyrus anterior: 0.047654154499829834 Angular gyrus inferior - Superior frontal gyrus: 0.030258537495194797 Angular gyrus inferior - Caudate: 0.028448207842517767 Cuneus - Superior occipital gyrus: 0.020790559620870244 Cuneus - Inferior occipital gyrus: 0.03705204225019097 Superior frontal gyrus - Cingulate cortex posterior: 0.025950517569564447 Superior frontal gyrus - Cerebellum Crus II: 0.03335105687063897 Superior frontal gyrus - Cerebellum I-V: 0.0419723378386445 Superior frontal gyrus - Anterior Cingulate Cortex: 0.027084829406132466 Superior frontal gyrus - Paracentral lobule superior: 0.02789240584228514 Superior frontal gyrus - Occipital pole: 0.02117279894618387 Superior frontal gyrus - Middle frontal gyrus anterior: 0.03203904814356154 Superior frontal gyrus - Angular gyrus inferior: 0.030258537495194797 Central sulcus - Precuneus superior: 0.02569562202543034 Central sulcus - Supramarginal gyrus: 0.02396115759485133 Central sulcus - Callosomarginal sulcus: 0.02741210185858165 Central sulcus - Precuneus anterior: 0.027718512718858737 Central sulcus - Superior parietal lobule: 0.024475610625438158 Caudate - Cerebellum Crus II: 0.03953927947846987 Caudate - Anterior Cingulate Cortex: 0.02546249725542627 Caudate - Superior rostral gyrus: 0.02797784006503763 Caudate - Inferior frontal gyrus: 0.026291502318687574 Caudate - Angular gyrus inferior: 0.028448207842517767
# grab center coordinates for probabilistic atlas
coordinates = plotting.find_probabilistic_atlas_cut_coords(
maps_img=difumo.maps
)
# plot connectome with 85% edge strength in the connectivity
plotting.plot_connectome(
feat_exp_matrix,
coordinates,
edge_threshold="85%",
title=f"DiFuMo with {dim} dimensions (probabilistic)",
)
plotting.show()
Grabbing Center Coordinates for Probabilistic Atlas:
coordinates = plotting.find_probabilistic_atlas_cut_coords(maps_img=difumo.maps): This line of code uses thefind_probabilistic_atlas_cut_coords()function from theplottingmodule in Nilearn to extract the center coordinates for the probabilistic atlas.- The
maps_img=difumo.mapsargument specifies the probabilistic atlas image from which the coordinates will be extracted.
Plotting the Connectome:
plotting.plot_connectome(): This function is used to visualize connectivity networks (connectomes) using brain surface plots or scatter plots.- Arguments:
feat_exp_matrix: The feature importance matrix or the connectivity matrix to be visualized.coordinates: The coordinates of brain regions, typically obtained from the atlas used to parcellate the brain.edge_threshold="85%": Specifies the threshold for displaying edges (connections) in the connectome. Here, "85%" means that only edges with strengths in the top 85% will be displayed.title=f"DiFuMo with {dim} dimensions (probabilistic)": The title of the plot. It dynamically includes the dimensionality (dim) of the DiFuMo atlas used and specifies that it's a probabilistic atlas.
Displaying the Plot:
plotting.show(): This function displays the plot generated by theplot_connectome()function.
It highlights strong connections between brain regions while excluding weaker connections based on the specified threshold. The resulting plot provides insights into the organization of brain networks derived from the connectivity data.
# Create a connectome map where each node is an ROI
coords = plotting.find_probabilistic_atlas_cut_coords(
maps_img=difumo.maps
)
plotting.plot_connectome(feat_exp_matrix, coords, colorbar=True, edge_threshold=0.035)
<nilearn.plotting.displays._projectors.OrthoProjector at 0x11b87b25d80>
plotting.view_connectome(feat_exp_matrix, coords, edge_threshold='98%',
edge_cmap='viridis')
threshold = 0.09 # Adjust this threshold as needed
# Iterate over the correlation matrix and print the values
for i in range(len(labels)):
for j in range(len(labels)):
if i != j and feat_exp_matrix[i, j] >= threshold:
print(f"{labels[i]} - {labels[j]}: {feat_exp_matrix[i, j]}")
Anterior Cingulate Cortex - Angular gyrus inferior: 0.09245993901160833 Angular gyrus inferior - Anterior Cingulate Cortex: 0.09245993901160833
Anterior Cingulate Cortex (ACC) - Angular Gyrus Inferior (AGI):
- The correlation value is 0.09245993901160833.
- These two brain regions are known to be involved in different cognitive functions:
- The Anterior Cingulate Cortex (ACC) is associated with various cognitive processes, including attention allocation, emotion regulation, and error detection.
- The Angular Gyrus Inferior (AGI) is primarily involved in language processing, semantic cognition, and numerical processing.
- The positive correlation between ACC and AGI suggests that there is some degree of synchronized activity or connectivity between these regions during resting-state fMRI scans.
- In the context of ADHD, alterations in the connectivity between these regions may reflect disruptions in attentional control, cognitive processing, or other functions related to ADHD symptomatology.
- However, the correlation value is relatively low, indicating that the strength of connectivity between ACC and AGI is modest compared to other brain regions.
# Define a threshold to visualize only higher values
threshold = 0.09 # Adjust this threshold as needed
# Plot the matrix
plt.figure(figsize=(20, 18)) # Adjust the figure size as needed
plt.imshow(feat_exp_matrix, cmap='viridis', origin='upper', vmin=threshold)
plt.colorbar(label='Correlation Strength', fraction=0.046, pad=0.04) # Adjust color bar position
# Add labels to the ticks
plt.xticks(ticks=range(len(labels)), labels=labels, rotation=90)
plt.yticks(ticks=range(len(labels)), labels=labels)
# Add title
plt.title('Connectivity Matrix')
# Show the plot
plt.tight_layout() # Adjust layout to prevent overlap
plt.show()